package com.onellx.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@Slf4j
public class EurekaClientController {

    @Resource
    private RestTemplate restTemplate;

    private final String url = "http://eureka-client-8001";

    @GetMapping("/test1")
    public String test1(){
        ResponseEntity<String> forEntity = restTemplate.getForEntity(url+"/test1", String.class);
        return forEntity.getBody();
    }
    @GetMapping("/test2")
    public String test2(){
        return "test2....success";
    }
}
